//
//  PreviewBaseItemView.m
//  ICrEAM
//
//  Created by Cty on 2016/10/29.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "PreviewBaseItemView.h"

@implementation PreviewBaseItemView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (instancetype)initWithFrame:(CGRect)frame andTitle:(NSString *)title andSubTitle:(NSString *)subTitle{
    
    self = [super initWithFrame:frame];
    
    if(self){
        //第一行
        UILabel *labelTitle = [[UILabel alloc]initWithFrame:CGRectMake(0,ActualHeight(2), frame.size.width, ActualHeight(20))];
        labelTitle.text = title;
        labelTitle.font = TitleFont;
        labelTitle.textColor = ContentTextColor_Black;
        
        //第二行
//        if ([title isEqualToString:@"VIN"]) {
//            
//        }
        UITextField *labelSubTitle = [[UITextField alloc]initWithFrame:CGRectMake(0,labelTitle.bottomEdge+ActualHeight(5), frame.size.width, ActualHeight(20))];
        labelSubTitle.text = subTitle;
        labelSubTitle.font = ContentFont;
        labelSubTitle.textColor = ContentTextColor_Gray;
        labelSubTitle.inputView=[[UIView alloc] initWithFrame:CGRectZero];
        labelSubTitle.inputAccessoryView=[[UIView alloc] initWithFrame:CGRectZero];
        labelSubTitle.tintColor = [UIColor clearColor];
        UITextInputAssistantItem *item= labelSubTitle.inputAssistantItem;
        item.leadingBarButtonGroups = @[];
        item.trailingBarButtonGroups = @[];
        
//        UILabel *labelSubTitle = [[UILabel alloc]initWithFrame:CGRectMake(0,labelTitle.bottomEdge+ActualHeight(5), frame.size.width, ActualHeight(20))];
//        labelSubTitle.text = subTitle;
//        labelSubTitle.font = ContentFont;
//        labelSubTitle.textColor = ContentTextColor_Gray;
//        labelSubTitle.numberOfLines = 0;
        [self addSubview:labelTitle];
        [self addSubview:labelSubTitle];
        
    }
    return self;
}

- (instancetype)initWithFrame:(CGRect)frame andTitle:(NSString *)title andSubTitle:(NSString *)subtitle andType:(int)type
{
    self = [super initWithFrame:frame];
    
    if(self){
        //第一行
        UILabel *labelTitle = [[UILabel alloc]initWithFrame:CGRectMake(0,ActualHeight(2), frame.size.width, ActualHeight(20))];
        labelTitle.text = title;
        labelTitle.font = TitleFont;
        labelTitle.textColor = ContentTextColor_Black;
        
        //第二行
        
        UILabel *labelSubTitle = [[UILabel alloc]initWithFrame:CGRectMake(0,labelTitle.bottomEdge+ActualHeight(5), frame.size.width, ActualHeight(70))];
        labelSubTitle.text = subtitle;
        labelSubTitle.font = ContentFont;
        labelSubTitle.textColor = ContentTextColor_Gray;
        labelSubTitle.numberOfLines = 0;
        
        [self addSubview:labelTitle];
        [self addSubview:labelSubTitle];
        
    }
    return self;
}

@end
